<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<script type="text/javascript">
	$(function(){
		convert_paging("#banner_list",".paging");
		$('#popup_banner').dialog({
			autoOpen:false,
			show:'fade',
			height:'auto',
			width:'652px',
			modal:true,
			resizable:false,
			open:function(){
				putclickoutsidebody("#popup_banner");
				clearHeaderFooter();
			},close:function(){
			}
		});

		$('.banner_img').click(function(e) {
			e.preventDefault();
			e.stopPropagation();
			
			var cssE = {
				'margin':'10px auto',
			}
			$('#popup_banner').find('a').css(cssE);
			$('#popup_banner').dialog('open');
			$('#image_popup_banner').attr('src',$(this).attr("alt"));
		});
		$('#popup_banner').find('a').click(function(e) {
			e.preventDefault();
			e.stopPropagation();
			$('#popup_banner').dialog('close');
		});
		$('.banner_sequence').change(function(){
			id = $(this).attr('alt');
			id_split = id.split("_");
			banner_id = id_split[1];
			$.post($('#base_url').attr('alt')+'admin/system/change_banner_sequence',{banner_id : banner_id, urutan : $(this).val()}, function(data) {
				if(data == "sukses") alert("Show Number Sequence has been changed");
			});
			$("#banner_list").load($("#base_url").attr("alt")+"admin/system/banner_load");
		});
	})
</script>
		<?php if(count($banner_list) == 0){ ?>
            <div class="title col1">No Banner</div>
            <?php }else{ ?>
                <div class="title col1">Title</div>
                <div class="title col2">Link To</div>
                <div class="title col3">Show Number Sequence</div>
                <div class="clear"></div>
                <!-- perulangan -->
                <?php
				$i = 0;
				foreach($banner_list as $list){
					$i++;
				?>
                    <div class="<?php echo ($i % 2 ==1)?"odd":"even";?>">
                        <div class="col1" style="padding-left:5px;"><?php echo $list['title'];?></div>
                        <div class="col2"><?php echo isset($list['link_to'])?$list['link_to']:"";?></div>
                        <div class="col3">
                            <select class="banner_sequence" alt="bannersequence_<?php echo $list['id'];?>">
                            	<?php for($k=0; $k < 7; $k++){ ?>
                                <option value="<?php echo $k;?>" <?php echo ($list['order_number']==$k)?'selected="selected"':'';?>><?php echo $k;?></option>
								<?php } ?>
                            </select>
                        </div>
                        <div class="col4"><a href="" class="button_red banner_img" alt="<?php echo base_url();?>banner/<?php echo $list['picture_link'];?>">Show Image</a><a href="<?php echo base_url();?>admin/system/delete_banner/<?php echo $list['id'];?>" onclick="return confirm('Are you sure want to delete this banner?');"><img src="<?php echo base_url();?>img/btndelete.png" title="delete" /></a></div>
                        <div class="clear"></div>
                    </div>
                <?php } ?>
                <!-- akhir perulangan -->
                <div class="paging"><?php echo $pagination;?></div>
            <?php } ?>
			<div id="popup_banner">
                <img src="<?php echo base_url();?>banner/slide-2.jpg" id="image_popup_banner" />
                <div class="clear"></div>
                <a href="" class="button_red">Close</a>
            </div>